<template>
	<view class="myorders">
		<view class="order-item">
			<view hover-class="none" class="order-top">
				<view class="order-date">订单编号: {{order.payorder}}</view>
				<view class="order-status" v-if="order.ok==1">待付款</view>
				<view class="order-status order-status__org" v-if="order.ok==2">已付款</view>
				<view class="order-status order-status__ok" v-if="order.ok==3">已完成</view>
			</view>
			<view class="order-shop" hover-class="none">
				<view class="order-shop-item" v-for="(sitem,sindex) in order.OrderList" :key="sindex">
					<view class="order-shop-bg">
						<view class="jximgbox">
							<view class="jxstips">{{sitem.Class}}</view>
							<image class="jximg" :src="sitem.PicFiles" mode="aspectFit"></image>
						</view>
					</view>
					<view class="order-shop-info">
						<view class="order-shop-info-h1">{{sitem.Titles}}</view>
						<view class="order-shop-info-price">￥{{sitem.Price}}</view>
						<view>
							<view class="order-shop-info-num">
								<uni-icons type="closeempty" size="12" color="#999"></uni-icons>
								<text>{{sitem.count}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="order-shop-tol">
				<view class="order-shop-tol-l">
					<view class="order-shop-tol-h1">
						<uni-dateformat :date="order.paytime" :threshold="[0,0]" format="yyyy-MM-dd"></uni-dateformat>
					</view>
					<view class="order-shop-tol-h2">共{{order.nums}}件商品</view>
				</view>
				<view class="order-shop-tol-r">
					<view class="order-shop-tol-price">
						<view>合计金额 :</view>
						<text>￥{{order.paymoney}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="orderform">
			<textarea v-model="ordeript" placeholder="请输入服务要求/理由"></textarea>
		</view>
		<view class="ordersubmit">提 交</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue";
	import {
		onLoad
	} from "@dcloudio/uni-app"
	const order = ref({
		id: 1,
		payorder: 2024566700,
		ok: 1,
		nums: 3,
		paymoney: 123.12,
		paytime: '2020/10/20 20:20:20',
		OrderList: [{
			id: 1,
			Class: "中药配方颗粒",
			Titles: '酒白芍配方颗粒酒白芍配方颗粒',
			PicFiles: "http://baihang.com.cn/Upload/image/2021090904LMFFG9.jpg",
			Price: 12.12,
			spcc: "每袋装0.83g",
			count: 3
		}, {
			id: 1,
			Class: "中药配方颗粒",
			Titles: '酒白芍配方颗粒酒白芍配方颗粒',
			PicFiles: "http://baihang.com.cn/Upload/image/2021090904LMFFG9.jpg",
			Price: 12.12,
			spcc: "每袋装0.83g",
			count: 3
		}]
	})
	const ordeript = ref('');
</script>

<style lang="scss">
	page {
		background: #f3f3f3;
	}

	.myorders {
		padding: 20rpx;
	}

	.order-item {
		margin-bottom: 20rpx;
		padding: 20rpx;
		background: $cf;
		border-radius: 10rpx;

		.order-top {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 20rpx;

			.order-date {
				font-size: 24rpx;
				color: $c9;
			}

			.order-status {
				font-size: 24rpx;
				color: $red;

				&__org {
					color: #ffaa00;
				}

				&__ok {
					color: $c9;
				}
			}
		}

		.order-shop {
			&-item {
				display: flex;
				margin-bottom: 20rpx;

				&:last-child {
					margin-bottom: 0;
				}
			}

			&-bg {
				width: 185rpx;
				flex-shrink: 0;

				.jximgbox {
					background: #f4f4f4;
					border-radius: 10rpx;
					overflow: hidden;
				}
			}

			&-info {
				flex: 1;
				width: 100%;
				overflow: hidden;
				margin-left: 20rpx;

				&-h1 {
					font-size: 30rpx;
					color: $c0;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
				}

				&-price {
					display: inline-block;
					border-bottom: 1px solid $c0;
					margin: 10rpx 0;
					font-size: 30rpx;
					color: $c0;
				}

				&-num {
					display: inline-block;
					border-bottom: 1px solid $c9;

					text {
						font-size: 24rpx;
						color: $c9;
					}
				}
			}

			&-tol {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 20rpx 0;
				box-sizing: border-box;
				border-top: 1px solid #eee;
				margin-top: 20rpx;

				&-h1 {
					font-size: 24rpx;
					color: #888;
				}

				&-h2 {
					font-size: 30rpx;
					color: #888;
				}

				&-price {
					display: flex;
					align-items: center;
					font-size: 30rpx;
					padding: 2px 0;
					color: #888;

					text {
						color: $red;
						font-weight: bold;
						margin-left: 2px;
					}
				}

			}
		}
	}

	.orderform {
		background: $cf;
		border-radius: 10rpx;
		padding: 20rpx;

		textarea {
			display: block;
			width: 100%;
		}
	}

	.ordersubmit {
		margin: 20rpx auto;
		background: $main-color;
		font-size: 30rpx;
		color: $cf;
		padding: 10rpx 0;
		border-radius: 10rpx;
		text-align: center;
	}
</style>